<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">

            <h:form id="bairroForm" enctype="multipart/form-data">
                <br/>
                <h3 class="title">Atualizar Logradouro</h3>
                <p:growl id="messages" showDetail="false" autoUpdate="true"  /> 
                <p:panel id="logradouroPanel" style="background: none; border: none;" 
                         styleClass="container_24 clearfix both ">
                    <h4 class="title">Dados Gerais</h4>

                    <p:outputLabel value="Logradouro" styleClass="grid_3" for="logradouro"/>
                    <p:inputText id="logradouro" styleClass="grid_20" value="#{managerLogradouro.dne.rua}" 
                                 required="true"  />
                    <div class="clear"/>

                    <p:outputLabel value="CEP" styleClass="grid_3" for="cep"/>
                    <p:inputMask id="cep" styleClass="grid_4" value="#{managerLogradouro.dne.cep}" 
                                 mask="99.999-999"/>

                    <p:outputLabel value="Bairro" styleClass="grid_3" for="bairro"/>
                    <p:autoComplete id="bairro" styleClass="grid_13" dropdown="true" converter="bairroconverter"
                                    var="bairro" itemLabel="#{bairro.nome.toString().concat(' - ').concat(bairro.cidade.nome).concat( ' - ' ).concat(bairro.cidade.estado.sgl)}"
                                    itemValue="#{bairro}" value="#{managerLogradouro.dne.bairro}"
                                    scrollHeight="200" forceSelection="true" required="true" 
                                    completeMethod="#{managerUtilitario.autocompleteBairroPorCidade}"/>
                    <div class="clear"/><br/>

                </p:panel>

                <div class="buttonAction">
                    <p:commandButton value="Salvar" icon="ui-icon-disk" 
                                     update="@form" 
                                     actionListener="#{managerLogradouro.salvar()}"
                                     styleClass="ui-priority-primary" />

                    <p:button href="index.xhtml" value="Cancelar"  icon="ui-icon-trash" />
                </div >
            </h:form>

        </ui:define> 
    </ui:composition>

</html>
